/*=============================================================================
*
*   Copyright (C) 2020 All rights reserved.
*
*   Filename:		elemental_dof.hpp
*
*   Author: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Date: 2020-03-04 17:39
*
*   Last Editors: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Last modified:	2020-08-04 01:24
*
*   Description:
*
=============================================================================*/
#ifndef ADD_ELEMENT_DOF_H
#define ADD_ELEMENT_DOF_H

#include "shape_interface.hpp"

namespace geoxfem {
namespace geometry {

template <typename CouplePolicy>
struct get_elemental_dof { /*{{{*/
  template <typename DimensionType, typename degree>
  static std::vector<model::Dof*>
  apply(const geometry::ShapeInterface<DimensionType, degree>&) {
    throw "not implemented yet";
  }
};
/*}}}*/

template <typename CouplePolicy>
struct get_elemental_neq { /*{{{*/
  template <typename DimensionType, typename degree>
  static size_t
  apply(const geometry::ShapeInterface<DimensionType, degree>& shp) {
    return get_elemental_dof<CouplePolicy>::apply(shp).size();
  }
};
/*}}}*/

template <typename CouplePolicy, typename Func>
struct get_value_list_at_elemental_dof { /*{{{*/
  template <typename DimensionType, typename degree>
  static VectorXR
  apply(const geometry::ShapeInterface<DimensionType, degree>& shp) {
    VectorXR vec;
    auto     doflist = get_elemental_dof<CouplePolicy>::apply(shp);
    vec.setZero(doflist.size());
    size_t i = 0;
    for(auto& dof : doflist)
      vec[i++] = Func::apply(dof);
    return vec;
  }
};
/*}}}*/

}  // namespace geometry
}  // namespace geoxfem

#endif /* ADD_ELEMENT_DOF_H */
